package cn.edu.abtu.vo;

import lombok.Data;
import lombok.ToString;

@Data
@ToString
public class ResponseData {

    private Integer code;

    private String msg;

    private Object data;

    //构造器私有
    private ResponseData(){}

    public static ResponseData success(){
        return new ResponseData(20000,"success",null);
    }

    public static ResponseData success(Object data){
        return new ResponseData(20000,"success",data);
    }

    public static ResponseData success(String msg,Object data){
        return new ResponseData(20000,msg,data);
    }

    public static ResponseData success(Integer code,String msg,Object data){
        return new ResponseData(code,msg,data);
    }

    public static ResponseData fail(){
        return new ResponseData(20001,"fail",null);
    }

    public static ResponseData fail(Object data){
        return new ResponseData(20001,"fail",data);
    }

    public static ResponseData fail(String msg,Object data){
        return new ResponseData(20001,msg,data);
    }

    public static ResponseData fail(Integer code,String msg,Object data){
        return new ResponseData(code,msg,data);
    }

    private ResponseData(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

}